
	<script src="<?echo base_url()?>assets/grocery_crud/texteditor/tiny_mce/jquery.tinymce.js"></script>
	<script src="<?echo base_url()?>assets/grocery_crud/js/jquery_plugins/config/jquery.tine_mce.config.js"></script>
	<script>
		$(document).ready(function() {
			$("#selFotoPrincipal").kendoDropDownList({
				optionLabel: "Seleccionar Principal...",
				dataTextField: "name",
				dataValueField: "name",
				value: "<?=($propiedad==NULL) ? "" : $propiedad->fotoPrincipal; ?>",
				// define custom template
				template: '<img src=\"${data.pathMini}\" alt=\"${data.name}\" />' +
							  '<p>${ data.name }</p>' ,
				dataSource: {
					transport: {
						read: {
							dataType: "json",
							url: "<?=base_url()?>index.php/inmueble/getFotos/<?=($propiedad==NULL) ? "" : $propiedad->idPropiedad; ?>",
						}
					}
				}
			});
			$("#selFotoPlano").kendoDropDownList({
				optionLabel: "Seleccionar Plano...",
				dataTextField: "name",
				dataValueField: "name",
				value: "<?=($propiedad==NULL) ? "" : $propiedad->fotoPlano; ?>",
				// define custom template
				template: '<img src=\"${data.pathMini}\" alt=\"${data.name}\" />' +
							  '<p>${ data.name }</p>' ,
				dataSource: {
					transport: {
						read: {
							dataType: "json",
							url: "<?=base_url()?>index.php/inmueble/getFotos/<?=($propiedad==NULL) ? "" : $propiedad->idPropiedad; ?>",
						}
					}
				}
			});
			var dropdownlist = $("#selFotoDefault").data("kendoDropDownList");
			
			$('#idLocalidad_field_box').hide();
			$('#idBarrio_field_box').hide();
			$('#field-idLocalidad').change(cargarBarrios);
			$("#txtDireccion").keydown(function(event){
				if(event.keyCode == 13 || event.keyCode == 10){
					$("#btnGeocode").click();
					return false;
				}
			});
			<? if ($propiedad!=NULL) {?>
				cargarLocalidades();
				cargarBarrios();
			<? } ?>
			
			
		});
		

		$(document).ready(function() { 
			// initialize();
			var input = document.getElementById("txtDireccion");
			var options; 
			initialize();
			autocomplete = new google.maps.places.Autocomplete(input);
			autocomplete.bindTo('bounds', map);  
			autocomplete = new google.maps.places.Autocomplete(input, options);
			if ($("#txtDireccion_lat").val() != ''){
				map.setCenter(new google.maps.LatLng($("#txtDireccion_lat").val(), $("#txtDireccion_lng").val())); 
				map.setZoom(14); 
				var marker = new google.maps.Marker({ 
					map: map, 
					position: new google.maps.LatLng($("#txtDireccion_lat").val(), $("#txtDireccion_lng").val()) 
				});
			}
		});

			/*			
			<div style='height:390px;'><input id='field-{$field_info->name}' name='{$field_info->name}' type='text' value=\"$value\" $extra_attributes />
			<input type='button' class='btn btn-large' id='geocode' value='Ubicar' onclick='javascript: codeAddress(\"field-{$field_info->name}\");'>
			<div id='map_canvas' style='height:350px;width:500px;top:5px'></div></div>
		*/
		
		function cargarLocalidades()	{
			if ($('#field-idZona').val() != ""){
				$.ajax({
					type:'POST',
					url:'<?php echo base_url(); ?>index.php/inmueble/getLocalidades',                    
					dataType:'json',
					data:{idZona: $('#field-idZona').val()},                    
					cache:false,
					success:function(aData){ 

						$('#field-idLocalidad').get(0).options.length = 0;
						$('#field-idLocalidad').get(0).options[0] = new Option("", "");  
						$.each(aData, function(i,item) {						
							$('#field-idLocalidad').get(0).options[$('#field-idLocalidad').get(0).options.length] = new Option(item.desc,item.id); // Display      Value
						});
						$('#idLocalidad_field_box').show();
						
						<? if ($propiedad!=NULL) {?>
						$('#field-idLocalidad').val(<?=$propiedad->idLocalidad ?>);
						cargarBarrios() 
						<? } ?>

					},
					error:function(){alert("Connection Is Not Available");}
				});
				return false;
			}else{
				$('#idLocalidad_field_box').hide();
				$('#field-idLocalidad').get(0).options.length = 0;
				$('#field-idLocalidad').get(0).options[0] = new Option("", "");  
				
				$('#idBarrio_field_box').hide();
			}
		};
		
		function cargarBarrios() {
			if ($('#field-idLocalidad').val() != ""){
				$.ajax({
					type:'POST',
					url:'<?php echo base_url(); ?>index.php/inmueble/getBarrios',                    
					dataType:'json',
					data:{idZona: $('#field-idZona').val(),idLocalidad: $('#field-idLocalidad').val()},                    
					cache:false,
					success:function(aData){ 

						$('#field-idBarrio').get(0).options.length = 0;
						$('#field-idBarrio').get(0).options[0] = new Option("", "");  
						$.each(aData, function(i,item) {						
							$('#field-idBarrio').get(0).options[$('#field-idBarrio').get(0).options.length] = new Option(item.desc,item.id); // Display      Value
						});
						$('#idBarrio_field_box').show();
						<? if ($propiedad!=NULL) {?>
							$('#field-idBarrio').val(<?=$propiedad->idBarrio ?>);
						<? } ?>
					},
					error:function(){alert("Connection Is Not Available");}
				});

				return false;
			}else{
				//$('#idLocalidad_field_box').hide();
				$('#idBarrio_field_box').hide();
				$('#field-idBarrio').get(0).options.length = 0;
				$('#field-idBarrio').get(0).options[0] = new Option("", "");  
			}
		}
		
		var validator = $("#crudForm").kendoValidator().data("kendoValidator");
		function saveAndBack(){
			if (validator.validate()) {
				$('#crudForm').attr('action','<?echo base_url()?>index.php/inmueble/saveAndBack/');
				$('#crudForm').submit();
			}
		}
		
		function uploadFile(){
			$('#fileupload').submit();
		}

	</script>
	
	<div class="tabbable">
		<ul class="nav nav-tabs ">
			<li class="active"><a class="linknegro" href="#pane1" data-toggle="tab">Informacion general</a></li>
			<li class=""><a class="linknegro" href="#pane3" data-toggle="tab">Espacios</a></li>
			<li class=""><a class="linknegro" href="#pane4" data-toggle="tab">Adicionales y Servicios</a></li>
			<li class=""><a class="linknegro" href="#pane5" data-toggle="tab">Etiquetas</a></li>
			<li class="<?= ($propiedad==NULL) ? "disabled" : "" ;?>"><a class="linknegro" <? if ($propiedad!=NULL) {?> href="#pane2"  data-toggle="tab" <?}?>>Imagenes</a></li>
		</ul>
		<?php echo form_open( "inmueble/save", 'method="post" id="crudForm" autocomplete="off" enctype="multipart/form-data"'); ?>
		<div class="tab-content">
			<div id="pane1" class="tab-pane active">
			
				<div class="flexigrid crud-form" style='width: 100%;'>	
					<div class="mDiv">
						<div class="ftitle">
							<div class='ftitle-left'>
								Agregar Propiedad
							</div>			
							<div class='clear'></div>
						</div>
						<div title="Minimize/Maximize" class="ptogtitle">
							<span></span>
						</div>
					</div>
					<div id='main-table-box'>
						<div class='form-div'>
							<div class='form-field-box odd' id="IdPropiedad_field_box">
								<div class='form-display-as-box' id="IdPropiedad_display_as_box">
									IdPropiedad :
								</div>
								<div class='form-input-box' id="IdPropiedad_input_box">
									<input id='field-IdPropiedad' readonly="readonly" name='idPropiedad' type='text' value='<?=($propiedad==NULL || $idPropiedadOriginal!=NULL) ? "" : $propiedad->idPropiedad; ?>' class='numeric' maxlength='11' />				
									<input id='field-IdPropiedadOriginal' readonly="readonly" name='idPropiedadOriginal' type='hidden' value='<?=($idPropiedadOriginal==NULL) ? "" : $idPropiedadOriginal; ?>' class='numeric' maxlength='11' />
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="idTipoOperacion_field_box">
								<div class='form-display-as-box' id="idTipoOperacion_display_as_box">
									Tipo de Operacion :
								</div>
								<div class='form-input-box' id="idTipoOperacion_input_box">
									<select id='field-idTipoOperacion'  name='idTipoOperacion' class='chosen-select' data-placeholder='Select IdTipoOperacion' style='width:300px' required>
										<option value=''></option>
										<?
											foreach ($tipooperacion as $val){
												if ($propiedad==NULL) 
												{
										?>	
													<option value="<?=$val->idTipoOperacion?>"><?=$val->descripcion?></option>
										<?
												} else {
										?>
													<option value="<?=$val->idTipoOperacion?>" <?=($propiedad->idTipoOperacion == $val->idTipoOperacion) ? "selected" :  "" ?> ><?=$val->descripcion?></option>
										<?
												}
										}
										?>
									</select>				
								</div>
								<div class='clear'></div>	
							</div>
							<? if ($propiedad!=NULL) { ?>
								<div class='form-field-box odd' id="cantPlantas_field_box">
									<div class='form-display-as-box' id="cantPlantas_display_as_box">
										Foto principal :
									</div>
									<div class='form-input-box' id="cantPlantas_input_box">
										<select id='selFotoPrincipal'  name='fotoPrincipal' class='chosen-select' data-placeholder='Select foto' style='width:220px'>
											<option></option>
										</select>
									</div>
									<div class='clear'></div>	
								</div>
							<? } ?>
							<? if ($propiedad!=NULL) { ?>
								<div class='form-field-box odd' id="cantPlantas_field_box">
									<div class='form-display-as-box' id="cantPlantas_display_as_box">
										Foto Plano :
									</div>
									<div class='form-input-box' id="cantPlantas_input_box">
										<select id='selFotoPlano'  name='fotoPlano' class='chosen-select' data-placeholder='Select foto' style='width:220px'>
											<option></option>
										</select>
									</div>
									<div class='clear'></div>	
								</div>
							<? } ?>
							<div class='form-field-box even' id="idTipoPropiedad_field_box">
								<div class='form-display-as-box' id="idTipoPropiedad_display_as_box">
									Tipo de Propiedad :
								</div>
								<div class='form-input-box' id="idTipoPropiedad_input_box">
									<select id='field-idTipoPropiedad' name='idTipoPropiedad' class='chosen-select' data-placeholder='Select IdTipoPropiedad' style='width:300px' placeholder="Operacion" required validationMessage="Completar {0}">
										<option value=''></option>
										<?
											foreach ($tipospropiedad as $val){
										?>	
											<option value="<?=$val->idTipo?>" <?=($propiedad!=NULL && $propiedad->idTipo == $val->idTipo) ? "selected" :  "" ?>><?=$val->descripcion?></option>
										<?
										}
										?>
									</select>			
									
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="titulo_field_box">
								<div class='form-display-as-box' id="titulo_display_as_box">
									Titulo :
								</div>
								<div class='form-input-box' id="titulo_input_box">
									<?php if ($propiedad==NULL) { ?>
										<input id='field-titulo' name='titulo' placeholder='Titulo' required validationMessage='Completar {0}' type='text' value="" maxlength='256' />
									<? } else { ?>
										<input id='field-titulo' name='titulo' placeholder='Titulo' required validationMessage='Completar {0}' type='text' value="<?php echo $propiedad->titulo; ?>" maxlength='256' />
									<? } ?>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="subtitulo_field_box">
								<div class='form-display-as-box' id="subtitulo_display_as_box">
									Subtitulo :
								</div>
								<div class='form-input-box' id="subtitulo_input_box">
									<?php if ($propiedad==NULL) { ?>
										<input id='field-subtitulo' name='subtitulo' type='text' value="" maxlength='256' />
									<? } else { ?>
										<input id='field-subtitulo' name='subtitulo' type='text' value="<?php echo $propiedad->subtitulo; ?>" maxlength='256' />
									<? } ?>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="subtitulo_field_box">
								<div class='form-display-as-box' id="subtitulo_display_as_box">
									Descripcion :
								</div>
								<div class='form-input-box' id="subtitulo_input_box">
										<textarea id="field-descripcion" name="descripcion" class="texteditor"><?=($propiedad==NULL) ? "" : $propiedad->descripcion; ?></textarea>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="entreCalle1_field_box">
								<div class='form-display-as-box' id="requisitos_display_as_box">
									Requisitos / Notas:
								</div>
								<div class='form-input-box' id="requisitos_input_box">
									<input id='field-requisitos' name='requisitos' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->requisitos; ?>" maxlength='2048' /></div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="idZona_field_box">
								<div class='form-display-as-box' id="idZona_display_as_box">
									Zona :
								</div>
								<div class='form-input-box' id="idBarrio_input_box">
									<select id='field-idZona' name='idZona' required class='chosen-select' style='width:300px' onchange="return cargarLocalidades()">
										<option value=''></option>
										<?
											foreach ($zonas as $val){
												if ($propiedad==NULL) 
												{
										?>	
													<option value="<?=$val->idZona?>"><?=$val->descripcion?></option>
										<?
												} else {
										?>
													<option value="<?=$val->idZona?>" <?=($localidad[0]->idZona == $val->idZona) ? "selected" :  "" ?> ><?=$val->descripcion?></option>
										<?
												}
										}
										?>
									</select>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="idLocalidad_field_box">
								<div class='form-display-as-box' id="idBarrio_display_as_box">
									Localidad :
								</div>
								<div class='form-input-box' id="idBarrio_input_box">
									<select id='field-idLocalidad' name='idLocalidad' required class='chosen-select' data-placeholder='Select idLocalidad' style='width:300px'>
										<option value=''></option>
									</select>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="idBarrio_field_box">
								<div class='form-display-as-box' id="idBarrio_display_as_box">
									Barrio :
								</div>
								<div class='form-input-box' id="idBarrio_input_box">
									<select id='field-idBarrio'  name='idBarrio' class='chosen-select' data-placeholder='Select IdBarrio' style='width:300px'>
										<option value=''></option>
									</select>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="IdPropiedad_field_box">
								<div class='form-display-as-box' id="IdPropiedad_display_as_box">
									Direccion :
								</div>
								<div class='form-input-box' id="IdPropiedad_input_box">
									<input id='txtDireccion' name='direccion' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->calleGoogle; ?>' class='numeric' maxlength='64' />
									<input id='txtDireccion_lat' name='direccion_lat' type='hidden' value='<?=($propiedad==NULL) ? "" : $propiedad->mapa_lat ?>' class='numeric' maxlength='64' />
									<input id='txtDireccion_lng' name='direccion_lng' type='hidden' value='<?=($propiedad==NULL) ? "" : $propiedad->mapa_lng ?>' class='numeric' maxlength='64' />
									<input type='button' class='btn btn-large' id='btnGeocode' value='Ubicar' onclick='javascript: codeAddress("txtDireccion"); '>
									<div id='map_canvas' style='height:350px;width:500px;top:5px'></div>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="calle_field_box">
								<div class='form-display-as-box' id="calle_display_as_box">
									Calle :
								</div>
								<div class='form-input-box' id="calle_input_box">
									<input id='field-calle' name='calle' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->calle; ?>" maxlength='512' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="altura_field_box">
								<div class='form-display-as-box' id="altura_display_as_box">
									Altura :
								</div>
								<div class='form-input-box' id="altura_input_box">
									<input id='field-altura' name='altura' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->altura; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="entreCalle1_field_box">
								<div class='form-display-as-box' id="entreCalle1_display_as_box">
									Entre calles:
								</div>
								<div class='form-input-box' id="entreCalle1_input_box">
									<input id='field-entreCalle1' name='entreCalle1' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->entreCalle1; ?>" maxlength='128' />				</div>
								<div class='clear'></div>	
							</div>
							<!--<div class='form-field-box odd' id="entreCalle2_field_box">
								<div class='form-display-as-box' id="entreCalle2_display_as_box">
									Entre calle:
								</div>
								<div class='form-input-box' id="entreCalle2_input_box">
									<input id='field-entreCalle2' name='entreCalle2' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->entreCalle2; ?>" maxlength='128' />				</div>
								<div class='clear'></div>	
							</div>-->
							<div class='form-field-box odd' id="ubicacion_field_box">
								<div class='form-display-as-box' id="ubicacion_display_as_box">
									Ubicacion:
								</div>
								<div class='form-input-box' id="entreCalle2_input_box">
									<input id='field-ubicacion' name='ubicacion' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->ubicacion; ?>" maxlength='128' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="superficieTotal_field_box">
								<div class='form-display-as-box' id="superficieTotal_display_as_box">
									SuperficieTotal :
								</div>
								<div class='form-input-box' id="superficieTotal_input_box">
									<input id='field-superficieTotal' name='superficieTotal' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->superficieTotal; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="superficieCubierta_field_box">
								<div class='form-display-as-box' id="superficieCubierta_display_as_box">
									SuperficieCubierta :
								</div>
								<div class='form-input-box' id="superficieCubierta_input_box">
									<input id='field-superficieCubierta' name='superficieCubierta' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->superficieCubierta; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="profesional_field_box">
								<div class='form-display-as-box' id="profesional_display_as_box">
									Apto profesional :
								</div>
								<div class='form-input-box' id="profesional_input_box">
									<div class='pretty-radio-buttons'>
									<? if ($propiedad != null) { ?>
										<label>
											<input id='field-profesional-true' class='radio-uniform'  type='radio' <?=($propiedad->profesional==1) ? "checked='checked'" : ""; ?> name='aptoProfesional' value='1'  /> Si
										</label> 
										<label>
											<input id='field-profesional-false' class='radio-uniform' type='radio' <?=($propiedad->profesional!=1) ? "checked='checked'" : ""; ?>  name='aptoProfesional' value='0'  /> No
										</label>
									<? } else { ?>
										<label>
											<input id='field-profesional-true' class='radio-uniform'  type='radio' name='aptoProfesional' value='1'  /> Si
										</label> 
										<label>
											<input id='field-profesional-false' class='radio-uniform' type='radio' name='aptoProfesional' value='0'  /> No
										</label>
									<? } ?>
									</div>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="cantAmbientes_field_box">
								<div class='form-display-as-box' id="cantAmbientes_display_as_box">
									Cant. Ambientes :
								</div>
								<div class='form-input-box' id="cantAmbientes_input_box">
									<input id='field-cantAmbientes' name='cantAmbientes' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->cantAmbientes; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="cantDormitorios_field_box">
								<div class='form-display-as-box' id="cantDormitorios_display_as_box">
									CantDormitorios :
								</div>
								<div class='form-input-box' id="cantDormitorios_input_box">
									<input id='field-cantDormitorios' name='cantDormitorios' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->cantDormitorios; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="cantDormitorios_field_box">
								<div class='form-display-as-box' id="cantDormitorios_display_as_box">
									Cant. Oficinas :
								</div>
								<div class='form-input-box' id="cantDormitorios_input_box">
									<input id='field-cantOficinas' name='cantOficinas' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->cantOficinas; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="profesional_field_box">
								<div class='form-display-as-box' id="profesional_display_as_box">
									Dependencia :
								</div>
								<div class='form-input-box' id="profesional_input_box">
									<div class='pretty-radio-buttons'>
										<? if ($propiedad!=null) { ?>
											<label>
												<input id='field-dependencia-true' class='radio-uniform' <?=($propiedad->dependencia==1) ? "checked='checked'" : ""; ?>   type='radio' name='dependencia' value='1'  /> Si
											</label> 
											<label>
												<input id='field-dependencia-false' class='radio-uniform' <?=($propiedad->dependencia!=1) ? "checked='checked'" : ""; ?> type='radio' name='dependencia' value='0'  /> No
											</label>
										<? } else {?>
											<label>
												<input id='field-dependencia-true' class='radio-uniform' type='radio' name='dependencia' value='1'  /> Si
											</label> 
											<label>
												<input id='field-dependencia-false' class='radio-uniform' type='radio' name='dependencia' value='0'  /> No
											</label>
										<? } ?>
									</div>
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="cantBanios_field_box">
								<div class='form-display-as-box' id="cantBanios_display_as_box">
									CantBanios :
								</div>
								<div class='form-input-box' id="cantBanios_input_box">
									<input id='field-cantBanios' name='cantBanios' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->cantBanios; ?>' class='numeric' maxlength='128' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="cantCocheras_field_box">
								<div class='form-display-as-box' id="cantCocheras_display_as_box">
									CantCocheras :
								</div>
								<div class='form-input-box' id="cantCocheras_input_box">
									<input id='field-cantCocheras' name='cantCocheras' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->cantCocheras; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="cantPlantas_field_box">
								<div class='form-display-as-box' id="cantPlantas_display_as_box">
									CantPlantas :
								</div>
								<div class='form-input-box' id="cantPlantas_input_box">
									<input id='field-cantPlantas' name='cantPlantas' type='text' value='' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="antiguedad_field_box">
								<div class='form-display-as-box' id="antiguedad_display_as_box">
									Antiguedad :
								</div>
								<div class='form-input-box' id="antiguedad_input_box">
									<input id='field-antiguedad' name='antiguedad' type='text' value='<?=($propiedad==NULL) ? "" : $propiedad->antiguedad; ?>' class='numeric' maxlength='11' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="precioPeso_field_box">
								<div class='form-display-as-box' id="precioPeso_display_as_box">
									PrecioPeso :
								</div>
								<div class='form-input-box' id="precioPeso_input_box">
									<input id='field-precioPeso' name='precioPeso' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->precioPeso; ?>" maxlength='10,2' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="precioDolar_field_box">
								<div class='form-display-as-box' id="precioDolar_display_as_box">
									PrecioDolar :
								</div>
								<div class='form-input-box' id="precioDolar_input_box">
									<input id='field-precioDolar' name='precioDolar' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->precioDolar; ?>" maxlength='10,2' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="precioDolar_field_box">
								<div class='form-display-as-box' id="precioDolar_display_as_box">
									Expensas :
								</div>
								<div class='form-input-box' id="precioDolar_input_box">
									<input id='field-expensas' name='expensas' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->expensas; ?>" maxlength='10,2' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="orientacion_field_box">
								<div class='form-display-as-box' id="orientacion_display_as_box">
									Orientacion :
								</div>
								<div class='form-input-box' id="orientacion_input_box">
									<input id='field-orientacion' name='orientacion' type='text' value="<?=($propiedad==NULL) ? "" : $propiedad->orientacion; ?>" maxlength='2' />				</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box odd' id="idEstadoInmueble_field_box">
								<div class='form-display-as-box' id="idEstadoInmueble_display_as_box">
									Estado de inmueble:
								</div>
								<div class='form-input-box' id="idEstadoInmueble_input_box">
									<select id='field-idEstadoInmueble'  name='idEstadoInmueble' class='chosen-select' data-placeholder='Select IdEstadoInmueble' style='width:300px'>
										<option value=''></option>
										<?
											foreach ($estadosPropiedad as $val){
												if ($propiedad==NULL) 
												{
										?>	
													<option value="<?=$val->idEstado?>"><?=$val->descripcion?></option>
										<?
												} else {
										?>
													<option value="<?=$val->idEstado?>" <?=($propiedad->idEstadoInmueble == $val->idEstado) ? "selected" :  "" ?> ><?=$val->descripcion?></option>
										<?
												}
										}
										?>
									</select>				
								</div>
								<div class='clear'></div>	
							</div>
							<div id='report-error' class='report-div error'></div>
							<div id='report-success' class='report-div success'></div>							
						</div>	
						<div class="pDiv">
							<div class='form-button-box'>
								<input type='submit' value='Guardar'  class="btn btn-large"/>
							</div>
							<div class='form-button-box'>
								<input type='button' onclick='javascript:saveAndBack();' value='Guardar y volver' id="save-and-go-back-button"  class="btn btn-large"/>
							</div>					
							<div class='form-button-box'>
								<input type='button' value='Cancelar' onclick="javascript: goToList()"  class="btn btn-large" />
							</div>
							<div class='form-button-box'>
								<div class='small-loading' id='FormLoading'>Insert Loading</div>
							</div>
							<div class='clear'></div>	
						</div>
					</div>
				</div>
			
			</div>
			<div id="pane3" class="tab-pane ">
							<?
							foreach ($espacios as $val){
							?>	
								<div class='form-field-box odd' id="profesional_field_box">
									<div class='form-display-as-box' id="profesional_display_as_box">
										<?=$val->descripcion?> :
									</div>
									<div class='form-input-box' id="adicional_input_box">
										<div class='pretty-radio-buttons'>
												<label>
													<input id='field-estado-<?=$val->idEspacio?>' class='radio-uniform'  type='text' name='espacios[]' <? if (array_key_exists($val->idEspacio, $propEspacios)) { ?> value='<?=$propEspacios[$val->idEspacio]?>' <? }?>   />
													<input id='field-estado-<?=$val->idEspacio?>-hidden' class='numeric'  type='hidden' name='espaciosId[]' value='<?=$val->idEspacio?>' />
												</label> 
										</div>
										
									</div>
									<div class='clear'></div>	
								</div>
							<?
							}
							?>
			</div>
			<div id="pane4" class="tab-pane ">
							<div class='form-field-box even' id="profesional_field_box">
								<div class='form-display-as-box' id="profesional_display_as_box">
									Adicionales :
								</div>
								<div class='form-input-box' id="adicional_input_box">
									<div class='pretty-radio-buttons'>
										<?
											foreach ($adicionales as $val){
										?>	
											<label>
												<input id='field-adicional-true' class='radio-uniform'  type='checkbox' name='adicional[]' <? if (in_array($val->idAdicional, $propAdicionales)) { ?> checked="checked" <?}?> value='<?=$val->idAdicional?>'  /> <?=$val->descripcion?>
											</label> 
										<?
										}
										?>
									</div>
									
								</div>
								<div class='clear'></div>	
							</div>
							<div class='form-field-box even' id="profesional_field_box">
								<div class='form-display-as-box' id="profesional_display_as_box">
									Servicios :
								</div>
								<div class='form-input-box' id="adicional_input_box">
									<div class='pretty-radio-buttons'>
										<?
											foreach ($servicios as $val){
										?>	
											<label>
												<input id='field-servicio-true' class='radio-uniform'  type='checkbox' name='servicio[]' <? if (in_array($val->idServicio, $propServicios)) { ?> checked="checked" <?}?> value='<?=$val->idServicio?>'  /> <?=$val->descripcion?>
											</label> 
										<?
										}
										?>
									</div>
									
								</div>
								<div class='clear'></div>	
							</div>
			</div>
			<div id="pane5" class="tab-pane ">

				<div class="imagenEtiqueta">
					<div class="radioEtiqueta"><input type="radio" <? if ($propiedad==NULL || $propiedad->imagenEtiqueta=='') { ?> checked='checked' <? } ?> name="idEtiqueta" value=""></input></div>
					<span> NINGUNA </span>
				</div>

				<?
				foreach ($etiquetas as $val){
				?>	
					<div class="imagenEtiqueta">
						<div class="radioEtiqueta"><input type="radio" <? if ($propiedad!=NULL && $propiedad->imagenEtiqueta==$val["name"]) { ?> checked='checked' <? } ?> name="idEtiqueta" value="<?echo  $val["name"]?>"></input></div>
						<img src="<?echo  $val["path"]?>">
					</div>
				<?
				}
				?>
			</div>
			<?php echo form_close(); ?>
			<div id="pane2" class="tab-pane ">
				<div class="container">

					<!-- The file upload form used as target for the file upload widget -->
					<form id="fileupload" action="<?=base_url()?>index.php/inmueble/upload/" method="POST" enctype="multipart/form-data">
						<input id='field-idPropiedadFile' name='idPropiedadFile' type='hidden' value='<?=($propiedad==NULL) ? "" : $propiedad->idPropiedad; ?>' class='numeric' maxlength='11' />
						<!-- Redirect browsers with JavaScript disabled to the origin page -->
						<noscript><input type="hidden" name="redirect" value="<?=base_url()?>index.php/inmueble/add"></noscript>
						<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
						<div class="row fileupload-buttonbar">
							<div class="span7">
								<!-- The fileinput-button span is used to style the file input field as button -->
								<span class="btn btn-success fileinput-button">
									<i class="icon-plus icon-white"></i>
									<span>Add files...</span>
									<input type="file" name="files[]" multiple>
								</span>
								<button type="submit" class="btn btn-primary start">
									<i class="icon-upload icon-white"></i>
									<span>Start upload</span>
								</button>
								<button type="reset" class="btn btn-warning cancel">
									<i class="icon-ban-circle icon-white"></i>
									<span>Cancel upload</span>
								</button>
								<button type="button" class="btn btn-danger delete">
									<i class="icon-trash icon-white"></i>
									<span>Delete</span>
								</button>

								<!-- The loading indicator is shown during file processing -->
								<span class="fileupload-loading"></span>
							</div>
							<!-- The global progress information -->
							<div class="span5 fileupload-progress fade">
								<!-- The global progress bar -->
								<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
									<div class="bar" style="width:0%;"></div>
								</div>
								<!-- The extended global progress information -->
								<div class="progress-extended">&nbsp;</div>
							</div>
						</div>
						<!-- The table listing the files available for upload/download -->
						<table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
					</form>
					<br>
				 </div>
				<!-- modal-gallery is the modal dialog used for the image gallery -->
				<div id="modal-gallery" class="modal modal-gallery hide fade" data-filter=":odd" tabindex="-1">
					<div class="modal-header">
						<a class="close" data-dismiss="modal">&times;</a>
						<h3 class="modal-title"></h3>
					</div>
					<div class="modal-body"><div class="modal-image"></div></div>
					<div class="modal-footer">
						<a class="btn modal-download" target="_blank">
							<i class="icon-download"></i>
							<span>Download</span>
						</a>
						<a class="btn btn-success modal-play modal-slideshow" data-slideshow="5000">
							<i class="icon-play icon-white"></i>
							<span>Slideshow</span>
						</a>
						<a class="btn btn-info modal-prev">
							<i class="icon-arrow-left icon-white"></i>
							<span>Previous</span>
						</a>
						<a class="btn btn-primary modal-next">
							<span>Next</span>
							<i class="icon-arrow-right icon-white"></i>
						</a>
					</div>
				</div>
				<!-- The template to display files available for upload -->
				<script id="template-upload" type="text/x-tmpl">
				{% for (var i=0, file; file=o.files[i]; i++) { %}
					<tr class="template-upload fade">
						<td>
							<span class="preview"></span>
						</td>
						<td>
							<p class="name">{%=file.name%}</p>
							{% if (file.error) { %}
								<div><span class="label label-important">Error</span> {%=file.error%}</div>
							{% } %}
						</td>
						<td>
							<p class="size">{%=o.formatFileSize(file.size)%}</p>
							{% if (!o.files.error) { %}
								<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
							{% } %}
						</td>
						<td>
							{% if (!o.files.error && !i && !o.options.autoUpload) { %}
								<button class="btn btn-primary start">
									<i class="icon-upload icon-white"></i>
									<span>Start</span>
								</button>
							{% } %}
							{% if (!i) { %}
								<button class="btn btn-warning cancel">
									<i class="icon-ban-circle icon-white"></i>
									<span>Cancel</span>
								</button>
							{% } %}
						</td>
					</tr>
				{% } %}
				</script>
				<!-- The template to display files available for download -->
				<script id="template-download" type="text/x-tmpl">
				{% for (var i=0, file; file=o.files[i]; i++) {  %}
					<tr class="template-download fade">
						<td>
							<span class="preview">
								{% if (file.thumbnail_url) { %}
									<a href="{%=file.url%}" title="{%=file.name%}" data-gallery="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
								{% } %}
							</span>
						</td>
						<td>
							<p class="name">
								<a href="{%=file.url%}" title="{%=file.name%}" data-gallery="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
							</p>
							{% if (file.error) { %}
								<div><span class="label label-important">Error</span> {%=file.error%}</div>
							{% } %}
						</td>
						<td>
							<span class="size">{%=o.formatFileSize(file.size)%}</span>
						</td>
						<td>
							<button class="btn btn-danger delete" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"{% if (file.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
								<i class="icon-trash icon-white"></i>
								<span>Delete</span>
							</button>
							<input type="checkbox" name="delete" value="1" class="toggle">
						</td>
					</tr>
				{% } %}
				</script>
			</div>
		</div><!-- /.tab-content -->
	</div><!-- /.tabbable -->

<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="<?=base_url()?>assets/upload_jquery/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="<?=base_url()?>assets/upload_jquery/js/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="<?=base_url()?>assets/upload_jquery/js/load-image.min.js"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<script src="<?=base_url()?>assets/upload_jquery/js/canvas-to-blob.min.js"></script>
<!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->

<script src="<?=base_url()?>assets/upload_jquery/js/bootstrap-image-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.fileupload.js"></script>
<!-- The File Upload processing plugin -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.fileupload-process.js"></script>
<!-- The File Upload image resize plugin -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.fileupload-resize.js"></script>
<!-- The File Upload validation plugin -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.fileupload-validate.js"></script>
<!-- The File Upload user interface plugin -->
<script src="<?=base_url()?>assets/upload_jquery/js/jquery.fileupload-ui.js"></script>
<!-- The main application script -->
<script src="<?=base_url()?>assets/upload_jquery/js/main.js"></script>
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
<!--[if gte IE 8]><script src="<?=base_url()?>assets/upload_jquery/js/cors/jquery.xdr-transport.js"></script><![endif]-->